function ajaxValidationCallback(json){
    if ("ROLE_USER" == json.role || "ROLE_ADMIN" == json.role || json.status==200){
        if ("ROLE_NOTACCEPTED" == json.role){
            $(".rmdr_email").text(rmdr_email = $("#email").val());
            $("#modal_rmdr_verify").dialog({
                minWidth:(isMobile()?260:340)
                });
            $("html").hideLoading();
        }else{
            window.location = "mystuff.htm";
        }
    }else {
        Alert("The username or password you entered is incorrect.\n<br/> Try again or <a class=\"a_typ\" href=\"login_help.htm\">reset your password</a>!");
        $("html").hideLoading();
    }
}
// binds form submission and fields to the validation engine
jQuery(document).ready(function(){
    jQuery('input[placeholder]').placeholder();
				
    function check_pass() {
        if($('#password').val() != '') $('#password_placeholder').hide();
    }
    if($.browser.msie) setInterval(check_pass, 100);

    $("#loginForm").validate({
        rules: {
            email:{
                required: true,
                email: true
            },
            password: {
                required: true, 
                minlength:6, 
                maxlength:40
            }
        },
        messages: {
            email: {
                required: "Please provide an email",
                email: "Please enter a valid email address"
            },
            password: {
                required: "Please provide your password"
            }
        },
        submitHandler: function(form) {
            $(form).ajaxSubmit({
                success: ajaxValidationCallback
            });
            $("html").showLoading();
            return false;
        },
        onkeyup:false
    });
    $('#password').keypress(function(event) {
        if ( event.which == 13 ) {
            $('#lookBtn').click();
        }
    });
		   
}); 